#
# Makefile for busy-wait IO tests
#
XCC     = gcc
AS	= as
LD      = ld
CFLAGS  = -c -fPIC -Wall -I. -I../include -mcpu=arm920t -msoft-float
# -g: include hooks for gdb
# -c: only compile
# -mcpu=arm920t: generate code for the 920t architecture
# -fpic: emit position-independent code
# -Wall: report all warnings

ASFLAGS	= -mcpu=arm920t -mapcs-32
# -mapcs: always generate a complete stack frame

LDFLAGS = -init main -Map a1.map -N  -T orex.ld -L/u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2 -L../lib

all:  a1_io.s a1_help.s a1.s a1.elf

a1_io.s: a1.h a1_io.c  
	$(XCC) -S $(CFLAGS) a1_io.c 
	
a1_io.o: a1_io.s
	$(AS) $(ASFLAGS) -o a1_io.o a1_io.s

a1_help.s: a1.h a1_help.c  
	$(XCC) -S $(CFLAGS) a1_help.c 

a1_help.o: a1_help.s
	$(AS) $(ASFLAGS) -o a1_help.o a1_help.s

a1.s: a1.h a1.c  
	$(XCC) -S $(CFLAGS) a1.c 

a1.o: a1.s
	$(AS) $(ASFLAGS) -o a1.o a1.s

a1.elf: a1_io.o a1_help.o a1.o
	$(LD) $(LDFLAGS) -o $@ a1_io.o a1_help.o a1.o -lbwio -lgcc

clean:
	-rm -f a1.elf *.s *.o a1.map
